;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
;;; HW7 blocks world + painting (stub)
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 

 
(define (domain hw6)
 
  (:requirements :strips)
 

 
  (:constants 
 
	red
 
	blue
 
	green
 
	)
 
	
 
  (:predicates 
 
	(on ?x ?y)
 
	(on-table ?x)
 
	(clear ?x)
 
	(arm-empty)
 
	(holding ?x)
 
	(color ?x ?c)
 
	(clean ?x)
 
	(paint ?x ?c)
 
	
 
	
 
	
 
  )	 
 
 (:action stack
 
	     :parameters (?sob ?sunderob)
 
	     :precondition (and (holding ?sob) (clear ?sunderob))
 
	     :effect
 
	     (and (not (holding ?sob))
 
		   (not (clear ?sunderob))
 
		   (clear ?sob)
 
		   (arm-empty)
 
		   (on ?sob ?sunderob)))
 
		   
 
(:action unstack
 
	     :parameters (?blockB ?blockA)
 
	     :precondition (and (on ?blockB ?blockA) (clear ?blockB) (arm-empty))
 
	     :effect
 
	     (and (holding ?blockB)
 
		   (clear ?blockA)
 
		   (not (clear ?blockB))
 
		   (not (arm-empty))
 
		   (not (on ?blockB ?blockA))))
 
		   
 
(:action wash-brush
 
	     :parameters (?brush ?waterbucket)
 
	     :precondition ( and (holding ?brush)
 
						(clear ?waterbucket)
 
						(Not(clean ?brush))
 
						(not(clear ?brush))
 
						(on-table ?waterbucket))
 
	     :effect
 
	     (and (clean ?brush)
 
		 (not(color ?brush red))
 
		 (not(color ?brush green))
 
		 (not(color ?brush blue))))
 
		 
 
(:action load-brush-with-color
 
	     :parameters (?brush ?can ?blue)
 
	     :precondition ( and (holding ?brush)
 
						(clean ?brush)
 
						(on-table ?can)
 
						(paint ?can red)
 
						(not(color ?blue  red))
 
						)
 
	     :effect
 
	     (and (color ?brush  red)
 
				(Not(clean ?brush))))
 
		 
 
(:action brush-paint
 
	     :parameters (?brush ?blockA )
 
	     :precondition ( and (holding ?brush)
 
						(on-table blockA)
 
						(clear blockA)
 
						(color ?brush  red)
 
						
 
						(Not(clean ?brush)))
 
	     :effect
 
	     (and (color ?blockA  red)))
 

 
						
 
	 
 
(:action spray-paint
 
	     :parameters (?blockB ?sprayerRed  ?red )
 
	     :precondition ( and (holding ?sprayerRed)
 
						(on-table ?blockB)
 
						(color ?sprayerRed  red)
 
						(color ?red  red)
 
						
 
						)
 
	     :effect
 
	     (and (color ?blockB  ?red)))
 

 
	   
 
		   
 
(:action put-down
 
	     :parameters (?obj1 )
 
	     :precondition (and (holding ?obj1) (not(arm-empty)))
 
	     :effect
 
	     (and (not (holding ?obj1))
 
		   (arm-empty)
 
		   (clear ?obj1)
 
		   (on-table ?obj1)))
 

 
		   
 
(:action pickup
 
	     :parameters (?obj)
 
	     :precondition (and (on-table ?obj)
 
						(clear ?obj)
 
						(arm-empty))
 
	     :effect
 
	     (and (holding ?obj)
 
		   (not(arm-empty))
 
		   (not (clear ?obj))
 
		   (not(on-table ?obj))))) 
